<!DOCTYPE html>
<html>
  <head>
    <title>jQuery WeUI</title>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

      <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

      <link rel="stylesheet" href="../src/lib/weui.css" type="text/css">
      <link rel="stylesheet" href="../src/lib/layer.css" type="text/css">
      <link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css" type="text/css">
      <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.0/css/jquery-weui.min.css" type="text/css">

      <link rel="stylesheet" href="css/demos.css">

  </head>

  <body ontouchstart>
  <!--http://layer.layui.com/mobile/-->

    <header class='demos-header'>
      <h1 class="demos-title">对话框</h1>
    </header>

    <div class='demos-content-padded'>
      <a href="javascript:;" id='show-alert' class="weui-btn weui-btn_primary">显示 Alert</a>
      <a href="javascript:;" id='show-confirm' class="weui-btn weui-btn_primary">显示 Confirm</a>
      <a href="javascript:;" id='show-prompt' class="weui-btn weui-btn_primary">显示 Prompt</a>
      <a href="javascript:;" id='show-login' class="weui-btn weui-btn_primary">显示登录弹窗</a>
      <a href="javascript:;" id='show-custom' class="weui-btn weui-btn_primary">显示自定义对话框</a>
    </div>
    <script src="../src/lib/jquery-2.1.4.js"></script>
    <script src="../src/lib/fastclick.js"></script>
    <script>   $(function () {
        FastClick.attach(document.body);
    }); </script>
    <script src="//cdn.bootcss.com/jquery-weui/0.8.0/js/jquery-weui.min.js"></script>
    <script src="../src/js/layer.js"></script>
    <script>

      $(document).on("click", "#show-alert", function() {
          //信息框
          layer.open({
              content: '移动版和PC版不能同时存在同一页面'
              ,btn: '我知道了'
          });
      });

      $(document).on("click", "#show-confirm", function() {
          //提示
          layer.open({
              content: 'hello layer'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
          });
      });

      $(document).on("click", "#show-prompt", function() {
        $.prompt({
          text: "名字不能超过6个字符，不得出现不和谐文字",
          title: "输入姓名",
          onOK: function(text) {
            $.alert("您的名字是:"+text, "角色设定成功");
          },
          onCancel: function() {
            console.log("取消了");
          },
          input: 'Mr Noone'
        });
      });

      $(document).on("click", "#show-custom", function() {
          //询问框
          layer.open({
              content: '您确定要刷新一下本页面吗？'
              ,btn: ['刷新', '不要']
              ,yes: function(index){
                  location.reload();
                  layer.close(index);
              }
          });
      });

      $(document).on('click', '#show-login', function() {
          //底部对话框
          layer.open({
              content: '这是一个底部弹出的询问提示'
              ,btn: ['删除', '取消']
              ,skin: 'footer'
              ,yes: function(index){
                  layer.open({content: '执行删除操作'})
              }
          });
      });
    </script>
  </body>
</html>
